package cn.com.dhcc.ddi.datamapping.dao;

import org.springframework.stereotype.Repository;

import cn.com.dhcc.app.core.dao.BaseDao;
import cn.com.dhcc.app.core.exception.DaoException;
import cn.com.dhcc.app.core.handler.modulehandler.WhereCondition;
import cn.com.dhcc.app.core.handler.pagerhandler.Pager;
import cn.com.dhcc.app.core.handler.pagerhandler.PagerData;
import cn.com.dhcc.app.pub.CM;
import cn.com.dhcc.ddi.datamapping.vo.FuncIdentify;
import cn.com.dhcc.ddi.datamapping.vo.wapper.FuncIdentifyRowWapper;

import java.util.List;

/**
 * 
 * @ClassName: FuncIdentifyDao
 * @Description: 函数管理
 * @author fxx
 * @date 2016-12-14
 * 
 */
@Repository
public class FuncIdentifyDao extends BaseDao{
	/**
	 * 获取对象
	 * @param id
	 * @return
	 * @throws DaoException
	 */
	public FuncIdentify get(String id) throws DaoException {
		return getDao().getModuleById("获取对象", FuncIdentify.class, new Object[]{id});
	}
	
	/**
	 * 
	 * @Title: getPagerList
	 * @Description: 获取函数列表信息
	 * @param @param pager
	 * @param @param searchParameter
	 * @param @return
	 * @param @throws DaoException 参数
	 * @return PagerData<FuncIdentify> 返回类型
	 * @throws
	 */
	public PagerData<FuncIdentify> getPagerList(Pager pager, WhereCondition searchParameter) throws DaoException{
		String sql = "select * from "+ SI_TABLE("t_ddi_fx_identify") +" t1 ";
		return CM.getDao().getPagerList("获取函数列表信息", sql, new FuncIdentifyRowWapper(), pager, searchParameter, new Object[]{});
	}
	
	/**
	 * 
	 * @Title: getById
	 * @Description: 获取函数对象
	 * @param @param id
	 * @param @return
	 * @param @throws DaoException 参数
	 * @return FuncIdentify 返回类型
	 * @throws
	 */
	public FuncIdentify getById(String id) throws DaoException{
		return CM.getDao().getModuleById("获取函数对象", FuncIdentify.class, new Object[]{id});
	}
	
	/**
	 * 
	 * @Title: list
	 * @Description: 获取函数列表
	 * @param @return
	 * @param @throws DaoException 参数
	 * @return List<FuncIdentify> 返回类型
	 * @throws
	 */
	public List<FuncIdentify> list() throws DaoException {
		String sql = "select * from "+ SI_TABLE("t_ddi_fx_identify") +" t1 where status='1' order by t1.fx_type,t1.fx_name_en ";
		return CM.getDao().listModule("获取函数列表", sql,FuncIdentify.class, new Object[]{});
	}
	
	/**
	 * 
	 * @Title: list
	 * @Description: 获取函数列表
	 * @param @return
	 * @param @throws DaoException 参数
	 * @return List<FuncIdentify> 返回类型
	 * @throws
	 */
	public List<FuncIdentify> getList(WhereCondition condition) throws DaoException {
		String sql = "select * from "+ SI_TABLE("t_ddi_fx_identify") +" t1 where status='1' ";
		return CM.getDao().listModule("获取函数列表", sql, FuncIdentify.class, condition);
	}
}
